﻿using Orchard.Data.Migration;
using System.Data;
using Orchard.Environment.Extensions;

namespace So.ShapeViewCounter
{
    [OrchardFeature("So.ShapeUserViewCounter")]
    public class UserViewMigrations : DataMigrationImpl
    {
        public int Create()
        {
            // Establishment item
            SchemaBuilder.CreateTable("ShapeUserViewCounterPartRecord", table => table
                .Column("Id", DbType.Int32, cfg => cfg.Identity().PrimaryKey())
                .Column("UserId", DbType.Int32)
                .Column("ContentItemId", DbType.Int32)
                .Column("ShapeName", DbType.String)
                .Column("ViewCount", DbType.Int32)
                .Column("LastViewed", DbType.DateTime)
            );
            return 1;
        }
    }
}